package com.lam.mall.entity;

import com.lam.common.validate.group.Add;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import java.util.Date;
import com.lam.common.utils.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableField;
import javax.validation.constraints.Null;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.components.dict.constant.DictTypeEnum;
import com.baomidou.mybatisplus.annotation.FieldFill;

/**
 * 订单配送地址对象 mall_order_addr
 * 
 * @author admin
 * @date 2023-04-25
 */
@TableName("mall_order_addr")
public class OrderAddr implements BaseEntity{

    /** 主键 */
    @Null(groups = Add.class, message="id必须为空")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    
    /** 用户ID */
    @NotBlank(message = "用户ID不能为空")
    @Size(max = 36, message = "用户ID长度不能超过36个字符")
    private String userId;

    /** 订单号 */
    @NotBlank(message = "订单号不能为空")
    @Size(max = 50, message = "订单号长度不能超过50个字符")
    private String orderNumber;

    /** 收货人 */
    @Size(max = 50, message = "收货人长度不能超过50个字符")
    private String receiver;

    /** 省ID */
    @Dict(dictCode = "provinceData", dictType = DictTypeEnum.TABLE_DICT, targetField = "province")
    private String provinceId;

    /** 省 */
    @Size(max = 100, message = "省长度不能超过100个字符")
    private String province;

    /** 城市 */
    @Size(max = 20, message = "城市长度不能超过20个字符")
    private String city;

    /** 城市ID */
    @Dict(dictCode = "cityData", dictType = DictTypeEnum.TABLE_DICT, targetField = "city")
    private String cityId;

    /** 区/县 */
    @Size(max = 20, message = "区/县长度不能超过20个字符")
    private String area;

    /** 区县ID */
    @Dict(dictCode = "areaData", dictType = DictTypeEnum.TABLE_DICT, targetField = "area")
    private String areaId;

    /** 邮编 */
    @Size(max = 15, message = "邮编长度不能超过15个字符")
    private String postCode;

    /** 详情地址 */
    @Size(max = 1000, message = "详情地址长度不能超过1000个字符")
    private String addr;

    /** 收货人手机 */
    @Size(max = 20, message = "收货人手机长度不能超过20个字符")
    private String mobile;

    /** 创建时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    
    /** 修改时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    
    public String getDetailAddr() {
    	return String.format("%s%s%s%s", province, city, area, addr);
    }
    
    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    } 

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }    
    
    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getOrderNumber() {
        return orderNumber;
    }    
    
    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getReceiver() {
        return receiver;
    }    
    
    public void setProvinceId(String provinceId) {
        this.provinceId = provinceId;
    }

    public String getProvinceId() {
        return provinceId;
    }    
    
    public void setProvince(String province) {
        this.province = province;
    }

    public String getProvince() {
        return province;
    }    
    
    public void setCity(String city) {
        this.city = city;
    }

    public String getCity() {
        return city;
    }    
    
    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getCityId() {
        return cityId;
    }    
    
    public void setArea(String area) {
        this.area = area;
    }

    public String getArea() {
        return area;
    }    
    
    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getAreaId() {
        return areaId;
    }    
    
    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public String getPostCode() {
        return postCode;
    }    
    
    public void setAddr(String addr) {
        this.addr = addr;
    }

    public String getAddr() {
        return addr;
    }    
    
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getMobile() {
        return mobile;
    }    
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}    
    

}
